<template>
  <div id="app">
    <van-grid square :column-num="3" :icon-size="36" :border="true" :gutter="20">
      <van-grid-item
        @click="sendToFather(item.text)"
        :to="item.route"
        v-for="item in itemInfos"
        :key="item.id"
        :icon="item.icon"
        :text="item.text"
      />
    </van-grid>
  </div>
</template>
<script>
const itemInfos = [
  {
    id: 1,
    icon: "home-o",
    text: "上班打卡",
    route: "/home/goToWork"
  },
  {
    id: 2,
    icon: "home-o",
    text: "下班打卡",
    route: "/home/goOffWork"
  },
  {
    id: 3,
    icon: "home-o",
    text: "出差记录",
    route: "/home/businessTravel"
  },
  {
    id: 4,
    icon: "home-o",
    text: "午饭费用记录",
    route: "/home/lunchExpenseRecord"
  },
  {
    id: 5,
    icon: "home-o",
    text: "出差费用记录",
    route: "/home/travelExpenseRecord"
  },
  {
    id: 6,
    icon: "home-o",
    text: "工资记录",
    route: "/home/payrollRecord"
  }
];
export default {
  data() {
    return {
      itemInfos,
      lastHash:''
    };
  },
  mounted() {},
  methods: {
    
    onClick(enent) {
      console.log(enent.target);
    },

    goToRouter(ele) {
      console.log(ele);
    },
    //向父组件传值
    sendToFather(text){
      this.$emit("sendToFather",text)
    }
  }
};
</script>
<style scoped>
#app {
  background-color: pink;
  box-sizing: border-box;
}
.van-grid {
  margin-top: 20px;
}
</style>
